package com.shuaigef.springbootinit.service.impl;


import com.shuaigef.springbootinit.common.BaseResponse;
import com.shuaigef.springbootinit.common.ResultUtils;
import com.shuaigef.springbootinit.oss.strategy.FileStrategy;
import com.shuaigef.springbootinit.service.FileService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Service
@Slf4j
@RequiredArgsConstructor
public class FileServiceImpl implements FileService {


    private final FileStrategy fileStrategy;

    private static final String BUCKET_NAME = "3create";

    @Override
    public BaseResponse<String> uploadFile(MultipartFile file) {
        // 上传文件
        String url = fileStrategy.uploadFile(file, BUCKET_NAME);

        return ResultUtils.success(url);
    }


}

